package controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mybatis.po.MyUser;

import service.UserService;
@RestController//需要配置 <mvc:annotation-driven/>
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/selectAllUser")
    public List<MyUser> selectAllUser() {
        return userService.selectAllUser();
    }
    @PostMapping("/addAUser")
    public int addAUser(MyUser myUser) {
        return userService.addAUser(myUser);
    }
    @PutMapping("/updateAUser")
    public int updateAUser(MyUser myUser) {
        return userService.updateAUser(myUser);
    }
    @DeleteMapping("/deleteAUser")
    public int deleteAUser(int id) {
        return userService.deleteAUser(id);
    }
    @GetMapping("/getOne")
    public MyUser getOne(int id) {
        return userService.getOne(id);
    }
}
